#ifndef  __COMMUNICATION_MANAGER_H_
#define  __COMMUNICATION_MANAGER_H_

#include "logger.h"

#include <google/protobuf/message.h>
#include <google/protobuf/descriptor.h>
#include <map>
#include <new>

using namespace ::google::protobuf;

#define GET_TYPENAME(msName) msName::descriptor()->full_name()

class CommunicationManager
{
public:
    CommunicationManager(){}
    ~CommunicationManager()
    {
        std::map<std::string, Message*>::iterator iter = m_MessageMap.begin();
        while(iter !=  m_MessageMap.end())
        {
            delete iter->second;
            iter->second = NULL;
            ++iter;
        }
        m_MessageMap.clear();
    }
    Message* CreateMessage(const std::string& name, const std::string& typeName);
    Message* GetMessage(const std::string& name);
//    char* GetRawBuff(const std::string& name);
//    char* CreateBuff(const std::string& name, const int32_t size);
    int RemoveMessage(const std::string& name);
private:
    std::map<std::string, Message*> m_MessageMap;
  //  std::map<std::string, char*> m_rawBuffMap;
};















#endif  //__COMMUNICATION_MANAGER_H_

/* vim: set expandtab ts=4 sw=4 sts=4 tw=100: */
